package com.vzoom.logdesensitization.strategyimpl;

import com.vzoom.logdesensitization.DesensitizationStrategy;
import com.vzoom.logdesensitization.util.StarUtil;

public class NsrsbhDesensitizationStrategy implements DesensitizationStrategy {
    @Override
    public String desensitization(Object origin) {
        String toString = String.valueOf(origin);
        if (origin == null) {
            return toString;
        }
        int length = toString.length();
        if (length > 1) {
            return toString.charAt(0) + StarUtil.getStar(length - 2) + toString.charAt(length - 1);
        }
        return toString;
    }
}
